<!DOCTYPE html>
<html lang="zh-CN">
<head>
 
<#include "bases/global_style.ftl">
<#include "bases/global_js.ftl">
<#include "bases/combo.ftl">
 
	    
	<script>
		var curent_page=${currentpage};

		function doDeleteTableRow(id)
		{//批量删除

			var index=$(".list-checkbox:checked").size();
			if(index==0 && !id){
				jAlert("未勾选要删除的对象");
    		}else{
    			jConfirm('确定暂停选中的对象?', '提示', function(r) {
    				
 				   if(r==true){
						var ids;
					    if(id){
					    	ids=id;
					    }else{
					    	ids=getCheckedIds();
					    }
						$("#searchform").attr("action","${base}/batchdel_conventional_fare?idStr="+ids);
	    		    	$("#searchform").submit();
				   }
    			});
    		}
            return true;
		}

		//批量暂停
		function batchPause(id)
		{
			var index=$(".list-checkbox:checked").size();
			if(index==0 && !id){
				jAlert("未勾选要暂停的对象");
			}else{
				jConfirm('确定暂停选中的对象?', '提示', function(r) { 
					 if(r==true){
						var ids;
					    if(id){
					    	ids=id;
					    }else{
					    	ids=getCheckedIds();
					    }
						$("#searchform").attr("action","${base}/batchpause_conventional_fare?idStr="+ids);
	    		    	$("#searchform").submit();
					 }
				});
			}
		}

		//批量开启
		function batchStart(id)
		{
			var index=$(".list-checkbox:checked").size();
			if(index==0 && !id){
				jAlert("未勾选要开启的对象");
			}else{
				jConfirm('确定开启选中的对象?', '提示', function(r) {
					 if(r==true){
						var ids;
					    if(id){
					    	ids=id;
					    }else{
					    	ids=getCheckedIds();
					    }
						$("#searchform").attr("action","${base}/batchstart_conventional_fare?idStr="+ids);
	    		    	$("#searchform").submit();
					 }
				});
			}
		}
 
 
		jQuery(document).ready(function()
		{
			var optInit = getOptionsFromForm();
            $("#Pagination").pagination(${totalRecord}, optInit);
            App.init();
		});
 
 
		//弹出修改界面
        function showEditDiv(id){
      	
        	showDialog("${base}/view_conventional_fare?task=edit&id="+id,"1400","1000");
          	
        } 
          
        function addEntity()
        {
        	showDialog("${base}/view_conventional_fare?task=add","1400","1000");
        }
	</script>
	
</head>

<body>

<#include "bases/navhead.ftl">
<#include "bases/sidebar.ftl">
<div class="page-container secMenu-content">

 
 	<div class="page-content">
 	
 		<div class="container-fluid">
 		
 			<div class="row-fluid">
 				<div class="span12">
 					<div class="portlet box green">
 						<div class="portlet-title">
 							<div class="caption"><i class="fa fa-cogs"></i>常规资费列表</div>
                            <div class="tools">
                                <a href="javascript:window.location.reload()" class="reload"></a>
                            </div>
 						</div>
 						
 						<div class="portlet-body flip-scroll">
 							<form id="searchform" action="<@spring.url '/conventional_fare_manage'></@spring.url>" method="POST">
 								<input  type="hidden" id="currentpage" name="page" value="0" />
                            	
                            	<div class="controls controls-row">

                            		<input type="text" name="name" class="form-control sheet-searchInput" value="<#if name??>${name}</#if>" placeholder="请输入资费名称">
                            		
                            		<button type="submit" class="btn blue" >搜索</button>
                            	</div>	 
                            	<div class="controls controls-row" style="margin-top: 20px">
                            	    <button type="button" class="btn green" onclick="addEntity()"><i class="fa fa-plus"></i>新增资费</button>
                            		<button type="button" class="btn blue"  onclick="batchStart()">批量开启</button>
                            		<button type="button" class="btn blue"  onclick="batchPause()">批量暂停</button>
                            		
                            	</div>	 
                            	
                            	
                            	<table class="table table-hover table-striped table-condensed list-table table-bordered">
                            		<thead>
                            			<tr>
                            				<th><input type="checkbox" class="checkbox-length list-checkboxAll"></th>
                            				<th style="text-align: center;">资费编号</th>
	          								<th style="text-align: center;">资费名称</th>
	          								<th style="text-align: center;">单价</th>
	          								<th style="text-align: center;">类型</th>
	          								<th style="text-align: center;">生效日期</th>
	          								<th style="text-align: center;">截止日期</th>
	          								<th style="text-align: center;">状态</th>
	          								<th style="text-align: center;">操作员</th>
	          								<th style="text-align: center;">最后操作时间</th>
	          								<th style="text-align: center;width: 180px">操作</th>
                            			</tr>
                            		</thead>
                            		<tbody>
                            		<#list conventional_postages_list as item>
                            		
                            			<tr>
                            				<#if item??>
                            				<th><input type="checkbox" class="list-checkbox" value="<#if item.getId()??>${item.getId()}</#if>"></th>
                            				<td style="text-align: center;"><#if item.getId()??>c${item.getId()}</#if></td>
                            				<td style="text-align: center;"><#if item.getName()??>${item.getName()}</#if></td>
                            				<td style="text-align: center;"><#if item.getUnitprice()??>${item.getUnitprice()/100}</#if><#if item.getUnitName()??>${item.getUnitName()}</#if></td>
                            			    <td style="text-align: center;"><#if item.getTypeName()??>${item.getTypeName()}</#if></td>
                            				<td style="text-align: center;"><#if item.getShowBeginTime()??>${item.getShowBeginTime()}</#if></td>
                            				<td style="text-align: center;"><#if item.getShowEndTime()??>${item.getShowEndTime()}</#if></td>
                            				<td style="text-align: center;"><#if item.getStatusName()??>${item.getStatusName()}</#if></td>
                            				<td style="text-align: center;"><#if item.getUsername()??>${item.getUsername()}</#if></td>
                            				<td style="text-align: center;"><#if item.getOperdate()??>${item.getOperdate()}</#if></td>
                            				<td style="text-align: center;">
                            					<a id="editButton" onclick="showEditDiv('${item.getId()}');" class="chakan">查看修改</a>
                            					<#if item.getStatus()==1><a onclick="batchPause('${item.getId()}')" class="status">暂停</a><#else><a onclick="batchStart('${item.getId()}')" class="status">开启</a></#if>
                            					<a onclick="doDeleteTableRow('${item.getId()}');" class="delTr">删除</a>
                            				</td>
                            				</#if>
                            			</tr>
                            		</#list>
                            		</tbody>
                            	</table>
                            	<div class="controls controls-row">
                                    <div id="Pagination" class="pagination"></div>
                               </div>
 							</form>
 						</div>
 					</div>
 				</div>
 			</div>
 			
 		</div>
 		
 	</div>
 	
 </div>
 
</div>
</body>